/*
* @Author: xfy
* @Date:   2017-09-02 11:08:47
* @Last Modified by:   xfy
* @Last Modified time: 2017-09-03 16:06:35
*/
'use strict';
var _supper = require('util/supper.js');
var _address = {
    //获取地址列表
    getAddressList : function(resolve, reject){
        _supper.request({
            url     : _supper.getServerUrl('/shipping!list'),
            data    : {
                pageSize : 50
            },
            success : resolve,
            error   : reject
        });
    },
    //保存新地址
    save : function(addressInfo, resolve, reject){
        _supper.request({
            url     : _supper.getServerUrl('/shipping!add'),
            data    : addressInfo,
            success : resolve,
            error   : reject
        });
    },
    //更新地址
    update : function(addressInfo, resolve, reject){
        _supper.request({
            url     : _supper.getServerUrl('/shipping!update'),
            data    : addressInfo,
            success : resolve,
            error   : reject
        });
    },
    //删除地址
    deleteAddress : function(shippingId, resolve, reject){
        _supper.request({
            url     : _supper.getServerUrl('/shipping!delete'),
            data    : {
                id : shippingId
            },
            success : resolve,
            error   : reject
        });
    },
    //获取一条地址的信息
    getAddress : function(shippingId, resolve, reject){
        _supper.request({
            url     : _supper.getServerUrl('/shipping!select'),
            data    : {
                id : shippingId
            },
            success : resolve,
            error   : reject
        });
    }
}
module.exports = _address;